﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Entity
{
    [Table("sys_org_user_management")]
    public class SysOrgUserManagement
    {
        [Column("user_id")]
        public int UserId { get; set; }

        [Column("job_id")]
        public int? JobId { get; set; }

        [Column("organization_id")]
        public int? OrganizationId { get; set; }

        // 数据库存储MD5加密后的密码（32位大写）
        [Column("user_password")]
        public string UserPassword { get; set; }

        [Column("user_account")]
        public string UserAccount { get; set; }

        [Required(ErrorMessage = "用户姓名不能为空")]
        [MaxLength(50, ErrorMessage = "姓名长度不能超过50个字符")]
        [Column("user_name")]
        public string UserName { get; set; }

        [Column("user_avatar")]
        public string UserAvatar { get; set; }

        // 数据库存储编码（0=未知，1=男，2=女），前端显示文字
        [Column("sex")]
        public string Sex { get; set; }

        [Phone(ErrorMessage = "手机号格式不正确")]
        [Column("phone_number")]
        public string PhoneNumber { get; set; }

        [Column("roles_id")]
        public int RolesId { get; set; }

        [Column("sorting")]
        public int Sorting { get; set; }

        [Column("note")]
        public string Note { get; set; }

        // 状态：0=禁用，1=正常
        [Column("status")]
        public string Status { get; set; }

        [Column("create_by")]
        public string CreateBy { get; set; }

        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        [Column("update_by")]
        public string UpdateBy { get; set; }

        [Column("update_time")]
        public DateTime? UpdateTime { get; set; }

        // 逻辑删除：0=未删除，1=已删除
        [Column("is_delete")]
        public string IsDelete { get; set; }

        // 关联查询字段（非数据库列）
        public string JobName { get; set; }
        public string DepartmentName { get; set; }
    }
}